home *** CD-ROM | disk | FTP | other *** search
- ;/* Source-File: test.c Hello_World - LOCALIZED!
-
- CatComp hello.cd CFILE hello_strings.h OBJFILE hello_strings.o
- CatComp hello.cd hello.ct CATALOG sys:locale/Catalogs/Français/hello.catalog NOOPTIM
- Quit
- */
-
- /* [Definition Includes] ****************************************************/
-
- #define CATCOMP_NUMBERS
- #include "hello_strings.h"
- #include <libraries/locale.h>
- #include <clib/exec_protos.h>
- #include <clib/locale_protos.h>
- #include <pragmas/exec_pragmas.h>
- #include <pragmas/locale_pragmas.h>
- #include <string.h>
- #include <proto/dos.h>
- #include <proto/exec.h>
-
- /* [Definition of Prototypes] ***********************************************/
-
- STRPTR __asm GetString(register __a0 struct LocaleInfo *li, register __d0 LONG stringNum);
-
-
- /* [Main-Program] **********************************************************
-
- This tiny localization example uses >NO< startupcode.. instead it uses
- the dos Write() function to write the string directly to the console
- window... so run from the CLI only!
-
- */
-
- void hello(void)
- {
- struct Library *LocaleBase; // locale library base
- struct LocaleInfo li;
-
- /* Open Dos Library */
-
- struct DosLibrary *DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 0L);
-
- /* Open Locale Library */
-
- li.li_Catalog = NULL;
- if(LocaleBase = OpenLibrary("locale.library",38))
- {
- li.li_LocaleBase = LocaleBase;
- li.li_Catalog = OpenCatalogA(NULL,"hello.catalog",NULL);
- }
-
- /* Translate one string.. for our example & write it to CLI window */
-
- Write(Output(), GetString(&li,MSG_HELLO), strlen(GetString(&li,MSG_HELLO)));
-
- /* Close Locale Library */
-
- if (LocaleBase)
- {
- CloseCatalog(li.li_Catalog);
- CloseLibrary(LocaleBase);
- }
-
- /* Close DOS Library & exit program... */
-
- CloseLibrary((struct Library *)DOSBase);
-
- }
-
-